package spire;

import com.spire.doc.Document;
import com.spire.doc.FileFormat;
import com.spire.doc.Section;
import com.spire.doc.documents.BorderStyle;
import com.spire.doc.documents.Paragraph;
import com.spire.doc.documents.SubSuperScript;
import com.spire.doc.documents.UnderlineStyle;
import com.spire.doc.fields.TextRange;
import com.spire.doc.fields.shape.Emphasis;

import java.awt.*;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: usagi
 * @Date: 2024/04/25/17:32
 * @Description:
 */
public class createApaper {

    public static void main(String[] args) {

        //创建一个Document类的对象
        Document document = new Document();

        //添加一个节
        Section sec = document.addSection();

        //添加一个段落
        Paragraph paragraph = sec.addParagraph();
        for(int i = 0;i<20;i++){
            TextRange tr = paragraph.appendText("\r\n以下是一些文字格式设置+" + i + "：\r\n");
            if(i==0){
                tr.getCharacterFormat().setBold(true);
            }
        }

        paragraph.getStyle().getCharacterFormat().setFontName("HarmonyOS Sans SC");
        //保存文档
        document.saveToFile("./doc/测试生成试卷.docx", FileFormat.Docx);
    }
}
